import {
  DefaultCrudRepository,
  juggler,
  repository,
  Getter,
  HasManyRepositoryFactory
} from '@loopback/repository';
import { User, TodoList } from '../models';
import { MysqlLocalDataSource } from '../datasources';
import { inject } from '@loopback/core';
import { TodoListRepository } from './todo-list.repository';

export class UserRepository extends DefaultCrudRepository<User,
  typeof User.prototype.id> {

  // public readonly todoLists: HasManyRepositoryFactory<TodoList, typeof User.prototype.id>;

  constructor(
    @inject('datasources.mysqlLocal') dataSource: MysqlLocalDataSource,
    // @repository.getter('TodoListRepository')
    // protected todoListRepositoryGetter: Getter<TodoListRepository>,
  ) {
    super(User, dataSource);

    // this.todoLists = this.createHasManyRepositoryFactoryFor(
    //   "todoLists",
    //   todoListRepositoryGetter
    // );
  }
}
